﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ruleweaver.Rules.CheckMethods
{
	public abstract class ComparisonMethod : CheckMethod
	{
		protected override bool SupportsTargetType(Type targetType)
		{
			var supported = false;

			if(targetType.IsGenericType && typeof(IComparable<>).IsAssignableFrom(targetType.GetGenericTypeDefinition()))
			{
				var comparableType = typeof(IComparable<>).MakeGenericType(targetType);

				supported = comparableType.IsAssignableFrom(targetType);
			}

			return supported;
		}
	}
}